//
//  ScreenTestController.m
//  phoneTool
//
//  Created by HappyMilk 02 on 2017/8/2.
//  Copyright © 2017年 tomi. All rights reserved.
//

#import "ScreenTestController.h"
#import "LoginHeader.h"

@interface ScreenTestController ()

@property (nonatomic) BOOL is_white;
@property (weak, nonatomic) IBOutlet UIView *view_hint;
@property (weak, nonatomic) IBOutlet UILabel *lab_one;
@property (weak, nonatomic) IBOutlet UILabel *lab_two;

@end

@implementation ScreenTestController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    _is_white = YES;
    
//    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap)];
//    tap.numberOfTapsRequired = 1;
//    [self.view_hint addGestureRecognizer:tap];
    
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOne)];
    tap1.numberOfTapsRequired = 1;
    [self.view addGestureRecognizer:tap1];
    
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTwo)];
    tap2.numberOfTapsRequired = 2;
    [self.view addGestureRecognizer:tap2];
    
    [UIView animateWithDuration:1 delay:5 options:UIViewAnimationOptionCurveEaseOut animations:^{
        _view_hint.alpha = 0;
    } completion:^(BOOL finished) {
        [_view_hint removeFromSuperview];
    }];
    
    self.lab_one.text = IS_CHINESE?@"单击变换颜色检测屏幕坏点":@"Tap Change Color Test Screen";
    self.lab_two.text = IS_CHINESE?@"双击返回上一界面":@"Double Tap Just Back";
    
}
- (void)tap{
    [UIView animateWithDuration:1 animations:^{
        _view_hint.alpha = 0;
    } completion:^(BOOL finished) {
        [_view_hint removeFromSuperview];
    }];
}
- (void)tapOne{
    if (_is_white) {
        self.view.backgroundColor = [UIColor blackColor];
        _is_white = NO;
    }else{
        self.view.backgroundColor = [UIColor whiteColor];
        _is_white = YES;
    }
}
- (void)tapTwo{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
